package com.cakeshop.servelt;

import com.cakeshop.model.Order;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Author 吴雨涛
 * @Date 2021/8/25
 * @Time 15:21
 * @DAY_NAME_FULL: 星期三
 * @Description:
 */
@WebServlet(name = "DeleteActionServlet",value = "/delete_action")
public class DeleteActionServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        Order order = (Order) req.getSession().getAttribute("order");
        int goodsid = Integer.parseInt(req.getParameter("goodsid"));
        order.deletes(goodsid);
        resp.getWriter().print("ok");
    }
}
